package com.soft.servlet;

import com.soft.entity.Goods;
import com.soft.service.Domain;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(name = "GoodsListServlet", urlPatterns = "/GoodsList")
public class GoodsListServlet extends HttpServlet {

    private Domain domain;

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        response.setCharacterEncoding("GBK");

        domain = new Domain();

        List<Goods> list = new ArrayList<Goods>();
        list = domain.getGoodsAll();
        request.setAttribute("GoodsList", list);
        request.getRequestDispatcher("/goodsManageList.jsp").forward(request, response);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {


        doGet(request,response);

    }

}
